
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.himanshoe.kalendar.Kalendar
import com.himanshoe.kalendar.KalendarEvent
import com.himanshoe.kalendar.KalendarEvents
import com.himanshoe.kalendar.KalendarType
import com.himanshoe.kalendar.color.KalendarColors
import com.himanshoe.kalendar.ui.component.day.KalendarDayKonfig
import com.himanshoe.kalendar.ui.firey.DaySelectionMode
import com.himanshoe.kalendar.ui.firey.KalendarSelectedDayRange
import com.himanshoe.kalendar.ui.firey.RangeSelectionError
import java.time.LocalDate


/*
*author:guyueyuan
*createTime:2024/11/17
*/

@Composable
fun ScheduleCalendar() {
    Kalendar(
        currentDay = kotlinx.datetime.LocalDate(2024,12,31),
        kalendarType = KalendarType.Firey,
        modifier = Modifier,
        showLabel = true,
        events = KalendarEvents(),
        kalendarHeaderTextKonfig = null,
        kalendarColors = KalendarColors.default(),
        kalendarDayKonfig = KalendarDayKonfig.default(),
        daySelectionMode = DaySelectionMode.Single,
        dayContent = null,
        headerContent = null,
        onDayClick = { selectedDay: kotlinx.datetime.LocalDate, events: List<KalendarEvent> ->
            // 处理单击日期事件
            println("Selected day: $selectedDay, Events: $events")
        },
        onRangeSelected = { selectedRange: KalendarSelectedDayRange, events: List<KalendarEvent> ->
            // 处理范围选择事件
            println("Selected range: $selectedRange, Events: $events")
        },
        onErrorRangeSelected = { error: RangeSelectionError ->
            // 处理无效范围选择错误
            println("Error: $error")
        }
    )
}

@Preview
@Composable
fun ScheduleCalendarPre() {
    ScheduleCalendar()
}